/**
 * 
 */
package com.axt.dbaudit.action.cfg;

import java.util.List;

import org.apache.struts2.json.annotations.JSON;
import com.axt.dbaudit.bean.cfg.EngineMgrBean;
import com.axt.dbaudit.model.cfg.EngineMgr;
import com.axt.soa.action.BaseAction;
import com.axt.soa.msg.types.MsgParam;

public class EngineMgrAction extends BaseAction{
	EngineMgrBean engineMgrBean = new EngineMgrBean();
	List<EngineMgr> engineMgrs = null;
	
	private String backTime; 
	private String storeTime; 
	private String diskAlarm; 
	private String diskLow; 
	private String diskLowOper;
	
	@JSON(name="enginemgrs")
	public List<EngineMgr> geteEngineMgrs() {
		return engineMgrs;
	}
	public void setEngineMgr(List<EngineMgr> engineMgrs) {
		this.engineMgrs = engineMgrs;
	}
	
	@JSON(name="errcode")
	public int getErrcode() {
		return errcode;
	}
	
	@JSON(name="errinfo")
	public String getErrinfo() {
		return errinfo;
	}
	
	/**
	 * @return the backTime
	 */
	public String getBackTime() {
		return backTime;
	}

	/**
	 * @param backTime the backTime to set
	 */
	public void setBackTime(String backTime) {
		this.backTime = backTime;
	}

	/**
	 * @return the storeTime
	 */
	public String getStoreTime() {
		return storeTime;
	}

	/**
	 * @param storeTime the storeTime to set
	 */
	public void setStoreTime(String storeTime) {
		this.storeTime = storeTime;
	}

	/**
	 * @return the diskAlarm
	 */
	public String getDiskAlarm() {
		return diskAlarm;
	}

	/**
	 * @param diskAlarm the diskAlarm to set
	 */
	public void setDiskAlarm(String diskAlarm) {
		this.diskAlarm = diskAlarm;
	}

	/**
	 * @return the diskLow
	 */
	public String getDiskLow() {
		return diskLow;
	}

	/**
	 * @param diskLow the diskLow to set
	 */
	public void setDiskLow(String diskLow) {
		this.diskLow = diskLow;
	}

	/**
	 * @return the diskLowOper
	 */
	public String getDiskLowOper() {
		return diskLowOper;
	}

	/**
	 * @param diskLowOper the diskLowOper to set
	 */
	public void setDiskLowOper(String diskLowOper) {
		this.diskLowOper = diskLowOper;
	}

	/**
	 * 更新引擎管理的参数
	 */
	public String updateEnginMgr()
	{
			EngineMgr engineMgr = new EngineMgr();
			engineMgr.setBackTime(backTime);
			engineMgr.setDiskAlarm(diskAlarm);
			engineMgr.setDiskLow(diskLow);
			engineMgr.setDiskLowOper(diskLowOper);
			engineMgr.setStoreTime(storeTime);
			
			engineMgrBean.updateEnginMgr(serverPath, engineMgr);
			
			setErrcode(engineMgrBean.getErrcode());
			setErrinfo(engineMgrBean.getErrinfo());
			
			return MsgParam.SUCCESS;
	}
	/**
	 * 查询引擎管理参数
	 */
	public String queryEnginMgr()
	{
		setEngineMgr(engineMgrBean.queryEngineMgr(serverPath));
		setErrcode(engineMgrBean.getErrcode());
		setErrinfo(engineMgrBean.getErrinfo());
		
		return MsgParam.SUCCESS;
		
	}
}
